<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="javax.servlet.http.Cookie"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登陆</title>
<jsp:include page="top.jsp"></jsp:include>
<style type="text/css">
body {
	padding-bottom: 50px;
}
</style>

</head>
<body>
	<div class="login">
		<div class="login-top">
			<b>登录</b> <a href="regist.jsp" role="button">还没有账号，立即注册</a>
		</div>
		<br />
		<div class="login-input">
			<br>
			<form
				action="${pageContext.request.contextPath }/login?
			<% if( request.getHeader("referer").endsWith("personalcenter.jsp")) {%>
			redirect=personalcenter.jsp
			<%} else { %>
			redirect
			<%} %>
			"
				method="post">
				<table border="0">
					<tbody>
						<tr>
							<td></td>
							<td><label for="user">用户名<sup>*</sup></label></td>
							<td></td>
							<td><input type="text" id="user" name="user" required
								value="${cookie.username.value}"></td>
						</tr>
						<tr>
							<td></td>
							<td><label for="password">密码<sup>*</sup></label></td>
							<td></td>
							<td><input type="password" id="password" name="password"
								required value="${cookie.password.value}"></input></td>
						</tr>
						<tr>
							<td></td>
							<th class="remember"><input type="checkbox" name="remember"
								value="remember"
								<%Cookie[] cookies = request.getCookies();
			String cookieName = "password";
			Cookie password = null;
			for (int i = 0; i < cookies.length; i++) {
				if (cookies[i].getName().equals(cookieName)) {
					password = cookies[i];
				}
			}
			if (password != null) {%>
								checked="checked" <%}%>><label for="remember">记住我</label></th>
							<th></th>
							<th class="remember" style="float: left"><a href="#"
								role="button">忘记密码？</a> &#12288; <%
 	String msg = request.getParameter("msg");
 	if (msg != null && !"".equals(msg)) {
 %> <span style="color: red"><%=msg%></span> <%
 	}
 %></th>
						</tr>
						<tr>
							<td></td>
							<th colspan="3"><input type="submit" value="登录"
								class="login-button" role="button"></th>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
	</div>
	<div class="fixed">
		<jsp:include page="foot.jsp"></jsp:include>
	</div>

</body>
</html>